package service

import (
	"github.com/go-test/model"
	"github.com/go-test/helper"
)


func GetUserById(id int) *model.User {
	user := &model.User{Id : id}
	has,_ := helper.XormEngine().Id(id).Get(user)
	if has {
		return user
	}
	return nil;
}

func SaveUser(user *model.User) int64 {
	id,_ := helper.XormEngine().InsertOne(user);
	return id;
}

func UpdateUser(user *model.User) int64 {
	id,_ := helper.XormEngine().Id(user.Id).Update(user);
	return id;
}

func DeleteUser(user *model.User) int64 {
	id,_ := helper.XormEngine().Delete(user);
	return id;
}
